﻿using System;
using Conference.Core.BL.Sync;
using TeaLightV5.Foundation.BL;
using TeaLightV5.Foundation.BL.Sync;

namespace Conference.Core.BL.Sync
{
    public partial class SyncContext : BaseSyncContext
    {

        public static void Synchronize()
        {
            // todo
            //ThreadPool.QueueUserWorkItem(new WaitCallback((stateInfo) =>
            //    {
            //        IsUpdating = true;
            //        try
            //        {
            //            Synchronize(new DateTime(2000, 1, 1));

            //            TestDataManager.Create();
            //        }
            //        catch(Exception ex)
            //        {
            //            Exceptions.Handle(ex);
            //        }
            //        IsUpdating = false;
            //    }));
        }

        public static bool IsUpdating
        {
            get;
            set;
        }

        static partial void Synchronize(DateTime fromDate);

        private static void Synchronize(SyncObject syncObject, DateTime fromDate)
        {
            syncObject.Update(fromDate);
        }
    }
}
